package model.effects;

import model.entity.Entity;

public class SleepEffect extends Effect{
	private int baseValue;
	
	public SleepEffect(int baseValue){
		this.baseValue = baseValue;
	}
	@Override
	public void modifyParameter(double modification) {
		double temp = modification * baseValue;
		baseValue = (int) temp;	
	}

	@Override
	public void doEffect(Entity e) {
		if(100*Math.random() <= baseValue)
			e.disable(baseValue);
	}

	@Override
	public String toString(double factor) {
		factor = Math.random() < .5 ? factor * -1 : factor;
		int newValue = (int)factor + this.baseValue;
		
		int sleepTime = newValue / 30;
		
		return "was put to sleep for " + sleepTime + " seconds.";
	}
}
